package com.jic.market.controller.manage;

import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.market.api.manage.OverlayApi;
import com.jic.market.request.manager.overlay.*;
import com.jic.market.response.manager.overlay.OverlayGroupQueryResponse;
import com.jic.market.response.manager.overlay.OverlayInfoQueryResponse;
import com.jic.market.response.manager.overlay.QueryPagePromotionResponse;
import com.jic.market.service.overlay.OverlayBaseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: gaolanyu
 * @date: 2020-03-20
 * @remark:
 */
@RestController
@RequestMapping("/overlay")
@Api(tags = {"叠加管理系统"})
@Slf4j
public class OverManageController implements OverlayApi {
    @Autowired
    OverlayBaseInfoService overlayBaseInfoService;

    @ApiOperation(value ="分页查询活动")
    @Override
    public RestResult<PageResult<QueryPagePromotionResponse>> queryPagePromotion(QueryPagePromotionRequest overlayAddRuleGroupRequest) {
        return overlayBaseInfoService.queryPagePromotion(overlayAddRuleGroupRequest);
    }

    @ApiOperation(value ="校验叠加规则")
    @Override
    public RestResult<Boolean> checkPromType(OverlayPromotionInfoCheckRequest overlayPromotionInfoCheckRequest) {
        return overlayBaseInfoService.checkPromType(overlayPromotionInfoCheckRequest);
    }

    @ApiOperation(value ="增加叠加规则组")
    @Override
    public RestResult<String> addOverlayGroup(OverlayAddRuleGroupRequest overlayAddRuleGroupRequest) {
        return overlayBaseInfoService.addOverlayGroup(overlayAddRuleGroupRequest);
    }

    @ApiOperation(value ="关闭叠加规则")
    @Override
    public RestResult<Boolean> closeOverlay(OverlayBaseRequest overlayBaseRequest) {
        return overlayBaseInfoService.closeOverlay(overlayBaseRequest);
    }

    @ApiOperation(value ="删除叠加规则")
    @Override
    public RestResult<Boolean> deleteOverlay(OverlayBaseRequest overlayBaseRequest) {
        return overlayBaseInfoService.deleteOverlay(overlayBaseRequest);
    }

    @ApiOperation(value ="查询叠加规则基础信息分页")
    @Override
    public RestResult<PageResult<OverlayInfoQueryResponse>> queryOverlayInfo(OverlayInfoQueryRequest overlayInfoQueryRequest) {
        return overlayBaseInfoService.queryOverlayInfo(overlayInfoQueryRequest);
    }

    @ApiOperation(value ="查询叠加规则组信息")
    @Override
    public RestResult<OverlayGroupQueryResponse> queryOverlayGroupInfo(OverlayGroupInfoQueryRequest overlayGroupInfoQueryRequest) {
        return overlayBaseInfoService.queryOverlayGroupInfo(overlayGroupInfoQueryRequest);
    }

    @ApiOperation(value ="设置叠加规则组信息")
    @Override
    public RestResult<Boolean> setOverlayGroup(OverlayGroupUpdateRequet overlayGroupUpdateRequet) {
        return overlayBaseInfoService.setOverlayGroup(overlayGroupUpdateRequet);
    }

    @ApiOperation(value ="增加叠加规则组活动信息")
    @Override
    public RestResult<Boolean> addOverlayGroupPromotionInfo(OverlayGroupAddPromotionRequest overlayGroupAddPromotionRequest) {
        return overlayBaseInfoService.addOverlayGroupPromotionInfo(overlayGroupAddPromotionRequest);
    }

    @ApiOperation(value ="删除叠加规则组活动信息")
    @Override
    public RestResult<Boolean> deleteOverlayGroupPromotionInfo(OverlayGroupDeletePromotionRequest overlayGroupDeletePromotionRequest) {
        return overlayBaseInfoService.deleteOverlayGroupPromotionInfo(overlayGroupDeletePromotionRequest);
    }
}
